<template>
  <div class="develop">
    <van-tabs v-model="tabsActive" background="#1effea33" title-active-color="#6e94ab" title-inactive-color="#5d6f6e" @click="tabClick">
      <van-tab v-for="(tab) in cData" :key="tab.suid" :title="tab.suname" sticky :name="tab.suid">
      </van-tab>
    </van-tabs>
    <time-progress :canvasData="canvasData" :tabClickType="type"/>
  </div>
</template>
<script>
import timeProgress from "./components/time-progress";
import { getChengZiProjects } from "@/request/api.js";
export default {
  name: "develop",
  components: {
    timeProgress,
  },
  props: ['cData'],
  data() {
    return {
      tabsActive: 0,
      canvasData: [],
      type: 1, // 1代表为父Tabs点击，2代表为当前点击
    };
  },
  mounted() {
    this.canvasData = this.cData;
  },
  methods:{
    tabClick(name) {
      this.type = 2;
      getChengZiProjects({suid: name}).then(res=>{
        this.canvasData = res;
      })
    },
    fTabClick() {
      this.type = 1;
      this.canvasData = this.cData;
    }
  }
};
</script>
<style lang="scss" scoped>
.develop {
  .tab-title {
      padding: 0 10px;
      text-align: left;
  }
}
</style>